import 'package:kepu/generated/json/base/json_convert_content.dart';
import 'package:kepu/model/animal_detail_entity.dart';

AnimalDetailEntity $AnimalDetailEntityFromJson(Map<String, dynamic> json) {
  final AnimalDetailEntity animalDetailEntity = AnimalDetailEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    animalDetailEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    animalDetailEntity.msg = msg;
  }
  final AnimalDetailData? data = jsonConvert.convert<AnimalDetailData>(
      json['data']);
  if (data != null) {
    animalDetailEntity.data = data;
  }
  return animalDetailEntity;
}

Map<String, dynamic> $AnimalDetailEntityToJson(AnimalDetailEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.toJson();
  return data;
}

extension AnimalDetailEntityExtension on AnimalDetailEntity {
  AnimalDetailEntity copyWith({
    int? code,
    String? msg,
    AnimalDetailData? data,
  }) {
    return AnimalDetailEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

AnimalDetailData $AnimalDetailDataFromJson(Map<String, dynamic> json) {
  final AnimalDetailData animalDetailData = AnimalDetailData();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    animalDetailData.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    animalDetailData.name = name;
  }
  final String? image = jsonConvert.convert<String>(json['image']);
  if (image != null) {
    animalDetailData.image = image;
  }
  final String? description = jsonConvert.convert<String>(json['description']);
  if (description != null) {
    animalDetailData.description = description;
  }
  final String? region = jsonConvert.convert<String>(json['region']);
  if (region != null) {
    animalDetailData.region = region;
  }
  final String? type = jsonConvert.convert<String>(json['type']);
  if (type != null) {
    animalDetailData.type = type;
  }
  return animalDetailData;
}

Map<String, dynamic> $AnimalDetailDataToJson(AnimalDetailData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['image'] = entity.image;
  data['description'] = entity.description;
  data['region'] = entity.region;
  data['type'] = entity.type;
  return data;
}

extension AnimalDetailDataExtension on AnimalDetailData {
  AnimalDetailData copyWith({
    int? id,
    String? name,
    String? image,
    String? description,
    String? region,
    String? type,
  }) {
    return AnimalDetailData()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..image = image ?? this.image
      ..description = description ?? this.description
      ..region = region ?? this.region
      ..type = type ?? this.type;
  }
}